// mock.js
const Mock = require('mockjs');

//写一个方法封装一下
function userInfo() {
    let arr = [];
    const detail = {
        id: '@id()', //得到随机id
        username: "@cname()", //随机生成中文名字
        date: "@date()", //随机生成日期
        avatar: "@image('200x200','red','#fff','avatar')", //生成图片(宽高，背景色，字体色，文本)
        description: "@paragraph()", //描述
        ip: "@ip()", //ip地址
        email: "@email()" //email
    };
    arr.push(detail);
    return arr;
}

Mock.mock('/user/detail', 'get', userInfo());